blog-banner

The history of databases at Netflix: From Cassandra to CockroachDB

Last edited on November 27, 2023

0 minute read

    In 2008, after Netflix pivoted from DVD-by-mail to streaming, they were running the streaming service on premise and suffered a 3-day outage. That was the beginning of their move to the cloud. First they moved to AWS. Then, in 2014, they adopted (and popularized!) Cassandra to support their need for global replication.

    In this two-part presentation, Netflix Senior Software Engineers Shengwei Wang and Shahar Zimmerman explain why Netflix has adopted CockroachDB and how they’re deploying it.

    Three Netflix use cases that don’t fit Cassandra Copy Icon

    In 2019 Netflix began to run into problems with Cassandra for certain use cases. At that time Netflix was seeing an increase in demand and an increase in their database requirements. For example, the studio side of Netflix was producing more shows and movies which added new data needs. Generally speaking, there was an increase in the need for consistent data, specifically for these three use cases:

    Cloud drive service: a file system-like service for media assets which was needed by the Netflix studio side of the business.

    Content delivery: Netflix built its own CDN called Open Connect, and they needed a control plane service to manage network devices around the world.

    Spinnaker: a continuous delivery platform on the cloud.

    These are all global services that need to support consistent transactions at times. Supporting consistent transactions is problematic with Cassandra, because in Cassandra you don’t get rich transactions. Instead, you have lightweight transactions, which are extremely performant, but limited. Also, the secondary indices in Cassandra are unreliable and often don’t work.

    The other options Netflix considered for these use cases were AWS Aurora as well as AWS DynamoDB but they ran into some limitations with scalability there.

    Netflix decided that they needed a scalable SQL database for those three use cases and established a set of requirements: Multi-active topology, global consistent secondary indices, global transactions, open source, and SQL.

    why-netflix-chose-cockroachdb

    As you can see from the graphic, CockroachDB satisfied each of these requirements and earned a seat at the Netflix architecture table.

    How is CockroachDB deployed at Netflix?Copy Icon

    how-netflix-uses-cockroachdb

    In 2020 Netflix deployed their first CockroachDB cluster in production. Today they have 100 production clusters and 150+ test clusters. At this time most of the clusters are deployed in a single region with three availability zones. The biggest CockroachDB cluster at Netflix is a 60-node, single-region cluster with 26.5 terabytes of data.

    In this section of the presentation, Shengwei Wang explains why Netflix does not use the CockroachDB binary, how Netflix navigates upgrades to new versions of CockroachDB, and how Netflix deploys/manages CockroachDB. You can get all those nuanced details directly from Shengwei right here:

    More CockroachDB at Netflix resourcesCopy Icon

    Since their adoption of CockroachDB in 2020 the Netflix tech blog has published a couple different articles about different use cases that leverage CockroachDB:

    Orchestrating Data/ML Workflows at Scale With Netflix Maestro

    Data Mesh — A Data Movement and Processing Platform @ Netflix

    Unlocking analytical use cases at Netflix with CockroachDB

    If you’re interested in learning how DoorDash, Booking.com, Santander, and other companies use CockroachDB you can find their presentations on our RoachFest home page, and you can read more case studies on our customers page.

    Customer
    Case Study
    Customer Story
    Media
    AWS
    Cassandra